<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.partner.prepay.role.form.Menu"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>设置权限</title>
		<%@ include file="/easyprepay/jsp/common/head.jsp"%>
		<%@ taglib uri="/easyprepay" prefix="easy"%>
		<script type="text/javascript">
			function getReturn(){
			location.href="<%=basePath%>userRole.do?method=allUserRole&";
			}
			function addFunction(roleId,roleName){
			var value="";
			var list = document.getElementsByName("function");
				for(var i =0;i<list.length;i++){	
					if(list[i].checked){
					
						value=value+list[i].value + ",";
					}
				}
				location.href="<%=basePath%>userRole.do?method=addRoleFunction&value="+value+"&roleId="+roleId+"&roleName="+roleName;
			}		
		</script>
	</head>

	<body>
		<!-- 
			
			
		
			
			
		
	
	 -->
		<%
			String roleId = (String) request.getAttribute("roleId");
			String roleName = (String) request.getAttribute("roleName");
		%>
		您正在对
		<%=roleName%>
		设置权限
		<hr>
		<table border=1 width=100%>
			<%
				List<Function> function = (List<Function>) request.getAttribute("function");
				List<Function> functionList = (List<Function>) request
						.getAttribute("functionList");
				int size = function.size();
				int fuSize = functionList.size();
				for (int i = 0; i < fuSize; i++) {
			%>
			<td>
				<input type="checkbox" value="<%=functionList.get(i).getId() %>"
					name="function"
					<%
		for(int j = 0 ; j<size;j++){
			if(function.get(j).getId().equalsIgnoreCase(functionList.get(i).getId())){
			
		
			%>
					checked="true" <%
		}
			}
		 %>><%=functionList.get(i).getFunctionName() %>
			</td>

			<%
				if ((i + 1) % 5 == 0) {
			%><tr>
				<%
					}
					}
				%>
			
			<tr>
				<td colspan="10" align="right">
					<input type="button" value="返回" onclick="getReturn();">
					<input type="button" value="确认添加"
						onclick='addFunction("<%=roleId%>","<%=roleName%>")'>
				</td>
			</tr>
		</table>
	</body>
</html>
